package com.zhaoyh.framework.taglib;


import com.zhaoyh.util.DateUtil;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import java.io.IOException;

public class RuntimeTag extends BodyTagSupport {

	private static final long serialVersionUID = 1L;

	private long timeMillis = -1L;

	@Override
	public int doEndTag() throws JspException {
		if (timeMillis == -1)
			return SKIP_BODY;

		try {
			pageContext.getOut().print(DateUtil.formatTime(timeMillis));
		} catch (IOException e) {
			e.printStackTrace();
		}

		return super.doEndTag();
	}

	public long getTimeMillis() {
		return timeMillis;
	}

	public void setTimeMillis(long timeMillis) {
		this.timeMillis = timeMillis;
	}
}
